package com.charm.information.adapter

import android.widget.ImageView
import android.widget.TextView
import com.chad.library.adapter.base.BaseViewHolder
import com.charm.codes.imageLoad.XGlide
import com.charm.frameworkarou.recycleadapter.QuickRecyAdapter
import com.charm.information.R
import com.charm.information.entity.EastItemEntity

/**
 * Created by tools on 2018/1/9.
 */
class EastHeadLineAdapter(list: List<EastItemEntity>?) : QuickRecyAdapter<EastItemEntity>(list) {
    override fun convert(helper: BaseViewHolder?, item: EastItemEntity?) {
        var title = helper!!.getView<TextView>(R.id.title)
        helper.setText(R.id.title, item!!.title)
                .setText(R.id.posterScreen, item!!.posterScreenName)
                .setText(R.id.collect, (item!!.publishDate / (100000 * (helper.adapterPosition + 1) * (helper.adapterPosition + 1))).toString() + " 人收藏")
        1515817713
        var image = helper!!.getView<ImageView>(R.id.image)
        title.text = item!!.title
        if (item.imageUrls != null) {
            if (item.imageUrls!![0] != null) {
                XGlide.getInstance().with(mContext)
                        .load(item.imageUrls!![0])
                        .placeholder(R.drawable.bg_block)
                        .error(R.drawable.bg_block)
                        .into(image)
                        .displayImage()
            }
        }
    }

    override fun getLayoutResId(): Int {
        return R.layout.item_east_line
    }

}